﻿<%@ Page Language="C#" MasterPageFile="~/Main.master" CodeBehind="DetailsList.aspx.cs" Inherits="DD_Extensions.DetailsList" %>


<asp:Content ID="HeadContent" ContentPlaceHolderID="HeadContent" Runat="Server">
	<script src="../../Scripts/jquery-1.7.1.js" type="text/javascript"></script>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
	<asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true">
		<DataControls>
			<asp:DataControlReference ControlID="FormView1" />
		</DataControls>
	</asp:DynamicDataManager>

	<h2 class="DDSubHeader"><%= table.DisplayName %></h2>

	<asp:UpdatePanel ID="UpdatePanel1" runat="server">
		<ContentTemplate>
			<asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true"
				HeaderText="List of validation errors" CssClass="DDValidator" />
			<asp:DynamicValidator runat="server" ID="DetailsViewValidator" ControlToValidate="FormView1" Display="None" CssClass="DDValidator" />

			<asp:FormView runat="server" ID="FormView1" DataSourceID="DetailsDataSource" 
				OnItemDeleted="FormView1_ItemDeleted" RenderOuterTable="false" 
				onitemcommand="FormView1_ItemCommand">
				<ItemTemplate>
					<table id="detailsTable" class="DDDetailsTable" cellpadding="0">
						<asp:DynamicEntity runat="server" />
						<tr class="td">
							<td colspan="2" class="CommandCell">
								<asp:LinkButton ID="EditButton" runat="server" CssClass="DDControl" Text="Edit" PostBackUrl='<%# table.GetActionPath(PageAction.Edit, GetDataItem()) %>' />
								<asp:LinkButton ID="CancelButton" runat="server" CssClass="DDControl" Text="Cancel" CommandName="Cancel" CausesValidation="false" ToolTip="Cancel Edit" />
								<asp:LinkButton ID="DeleteButton" runat="server" CssClass="DDControl" Text="Delete" CommandName="Delete"  OnClientClick='return confirm("Are you sure you want to delete this item?");'/>
							</td>
						</tr>
					</table>
				</ItemTemplate>
				<EmptyDataTemplate>
					<div class="DDNoItem">No such item.</div>
				</EmptyDataTemplate>
			</asp:FormView>

			<asp:FormView 
				runat="server"
				ID="ChildrenFormView" 
				DataSourceID="DetailsDataSource" 
				RenderOuterTable="false" >
			</asp:FormView>

			<asp:EntityDataSource ID="DetailsDataSource" runat="server" EnableDelete="true" />

			<asp:QueryExtender TargetControlID="DetailsDataSource" ID="DetailsQueryExtender" runat="server">
				<asp:DynamicRouteExpression />
			</asp:QueryExtender>

			<%--<br />
			<asp:LinkButton ID="ListHyperLink" runat="server" CssClass="DDControl" CommandName="List">Show All Items</asp:LinkButton>--%>
		</ContentTemplate>
	</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="EndOfBody" Runat="Server">
</asp:Content>
